from wordcloud import WordCloud
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np

mask = np.array(Image.open("300.jpeg"))
f = open('notebook.txt', 'r', encoding='utf-8')
text = f.read()
f.close()
wordcloud = WordCloud(
    background_color='white',  # 设置背景颜色为白色
    mask=mask,
    font_path='msyh.ttf',
    width=1920,
    height=1080
).generate(text)
wordcloud.to_file('p11.png')
